{% extends "data_edit.html" %}
{% load i18n %}
{% block form %}
{% autoescape off %} 
<tr>
        {{form.UserID|field_as_td_h}}
      <td  >{{form.UserID.errors }}</td>
      
    </tr>
    <input type="hidden" name="all_emp" id="id_all_emp" value="all"/>
    <tr>
        {{form.starttime|field_as_td_h}}
	 
      <td  >{{form.starttime.errors }}
     
    </tr>
    <tr>
	 {{form.endtime|field_as_td_h}}
      <td  >{{form.endtime.errors }}</td>
      
    </tr>


   {% for i,k in form.errors.items %}
   {{i}}{{k}}
   {% endfor %}
 {% endautoescape %}
{% endblock %} 
{% block addjs %}
function before_submit()
{
	var value = $("input[name='UserID']").val();
	$.ajax({
       url:"../../../att/getleave/?key="+value,
       type:"POST",
       async: false,
       dataType:"str",
       success:function(data){
			if (data == "true"){
				$('#id_info').html("<ul class='errorlist'><li>"+gettext('该人员已离职，不可编辑!')+"</li></ul><input type='hidden' id='flag' value = '1'>")
			}else{
				$('#id_info').html("<input type='hidden' id='flag' value = '0'>")
			}
        }
    });
    if($("#flag").val() == "0"){
    	return true;
    }else{
	    return false;
    }
}
{% endblock %}  